package com.bpr.webservice.repository;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.bpr.webservice.domain.Users;

public interface UsersRepository extends JpaRepository<Users, Long>{

	@Query("select u from Users u where username = :username")
	public Users authenticate(@Param("username") String username);
	
	@Query("select u from Users u where userid = :userid")
	public Users findByUserId(@Param("userid") Long userid);

	@Query("select u from Users u where username like :username ")
	public Page<Users> findByUsername(@Param("username") String uname, Pageable page);
}
